#include <54func.h>
int main(int argc, char *argv[])
{
    // ./0_client_udp 192.168.72.128 1234
    ARGS_CHECK(argc,3);
    int sockfd = socket(AF_INET,SOCK_DGRAM,0);
    struct sockaddr_in serverAddr;
    serverAddr.sin_family = AF_INET;
    serverAddr.sin_port = htons(atoi(argv[2]));
    serverAddr.sin_addr.s_addr = inet_addr(argv[1]);
    // 第一次必须是客户端向服务端发消息
    sendto(sockfd,"hello",5,0,
           (struct sockaddr *)&serverAddr, sizeof(serverAddr));
    char buf[4096] = {0};
    sleep(1);
    recvfrom(sockfd,buf,1,0,NULL,NULL);
    printf("buf = %s\n", buf);
    sleep(1);
    recvfrom(sockfd,buf,4096,0,NULL,NULL);
    printf("buf = %s\n", buf);
    return 0;
}

